<?php

namespace App\WeChat\OAuth;

use App\WeChat\Contracts\WeChatOAuth;
use EasyWeChat\Foundation\Application;
use Illuminate\Support\ServiceProvider;

class OAuthServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {



        $this->app->singleton(Application::class,function()  {
            $wx_config  = config('wechat');
            $app = new Application($wx_config);
            return $app;
        });

        $this->app->singleton(WeChatOAuth::class,EasyWeChatOAuth::class);



    }
}
